﻿using LinnerToolkit.Desktop.ModernUI.Windows.Controls;
using SimulationPTSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SimulationPTSystem.Views
{
    /// <summary>
    /// MainPage.xaml 的交互逻辑
    /// </summary>
    public partial class MainPage : NavigationPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        //private void TreeViewMenu_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        //{
        //    if (treeViewMenu.SelectedItem != null)
        //    {
        //        string tag = ((TreeViewItem)treeViewMenu.SelectedItem).Tag.ToString();
        //        switch (tag)
        //        {
        //            case "Exit":
        //                Application.Current.Shutdown();
        //                break;
        //            default:
        //                ((MainPageViewModel)DataContext).NavigateCommand.Execute("MainPageRegion/" + tag);
        //                break;
        //        }
        //    }
        //}

        private void AnimationButton_Click(object sender, RoutedEventArgs e)
        {
            if (sender is Button btn)
            {
                string tag = btn.Tag.ToString();
                btn.IsEnabled = false;
                foreach (AnimationButton animationButton in ContainerButton.Children)
                {
                    if (animationButton.Tag.ToString() != tag && !animationButton.IsEnabled)
                        animationButton.IsEnabled = true;
                }

                switch (tag)
                {
                    case "Exit":
                        Application.Current.Shutdown();
                        break;
                    default:
                        ((MainPageViewModel)DataContext).NavigateCommand.Execute("MainPageRegion/" + tag + "Page");
                        break;
                }
            }
        }
    }
}
